import React from 'react';
import RootSiblings from 'react-native-root-siblings';
import PhotoModalPage from './PhotoModalPage';


export const getVideo = (options) => showImagePicker('CameraViewPage', {...options, isVideo: true});

let sibling = null;

function showImagePicker(initialRouteName, options) {
    if (sibling) {
        return null;
    }
    sibling = new RootSiblings(
        <PhotoModalPage
            initialRouteName={initialRouteName}
            onDestroy={() => {
                sibling && sibling.destroy();
                sibling = null;
            }}
            {...options}
        />
    );
}